﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FrmGoodsEdit.aspx.cs" Inherits="Web.AdminPage.FrmGoodsEdit" %>

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <link href="../css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="../css/animate.min.css" rel="stylesheet">
    <link href="../css/style.min.css?v=4.1.0" rel="stylesheet">
    <title>Edit</title>
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <form method="post"  enctype="multipart/form-data"  aria-pressed="false"  contenteditable="false" id="frm">
            <div class="row">
                 <div class="col-sm-4">
                <img src="<%=model.imgpath %>" id="P_Img" class="img-thumbnail" />
            </div>
                <div class="col-sm-8">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>编辑</h5>
                            <input type="hidden" id="Id" name="Id" value="<%=model.Id %>"
                                class="form-control" />
                            <div class="ibox-tools">

                                <button id="save" class="btn btn-primary  btn-xs" type="submit">保存</button>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品编号</label>
                            <div class="col-sm-10">
                                <input type="text" id="goods_number" readonly name="goods_number" value="<%=model.goods_number %>" placeholder="商品编号" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品类型</label>
                            <div class="col-sm-10">
                            
                                 <select id="goods_type" name="goods_type"   class="form-control">
                                    <option value="0" >请选择</option>
                                    <%foreach (var item in  select_Goods_type_list)%>
                                     <% {%>
                                           <option value="<%=item.Value %>" <%=item.IsSelected %> ><%=item.Text %></option>
                                     <% } %>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品售价</label>
                            <div class="col-sm-10">
                                <input type="text" id="prices" name="prices" value="<%=model.prices %>" placeholder="商品售价" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">销量</label>
                            <div class="col-sm-10">
                                <input type="text" id="sellnums" name="sellnums" value="<%=model.sellnums %>" placeholder="销量" class="form-control" />
                            </div>
                        </div>
                         <div class="form-group">
                            <label class="col-sm-2 control-label">库存</label>
                            <div class="col-sm-10">
                                <input type="text" id="goods_nums" name="goods_nums" value="<%=model.goods_nums %>" placeholder="库存" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">首页排序优先度</label>
                            <div class="col-sm-10">
                                <input type="text" id="sellLevel" name="sellLevel" value="<%=model.sellLevel %>" placeholder="首页排序优先度" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">名称</label>
                            <div class="col-sm-10">
                                <input type="text" id="name" name="name" value="<%=model.name %>" placeholder="名称" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">图片</label>
                            <div class="col-sm-10">
                                <input type="file" id="imgpath" name="imgpath" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否热门</label>
                            <div class="col-sm-10">
                                <input type="text" id="Hot" name="Hot" value="<%=model.Hot %>" placeholder="1 热门 0 默认" class="form-control" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <script src="../js/jquery.min.js?v=2.1.4"></script>
    <script src="../js/bootstrap.min.js?v=3.3.6"></script>
    <script src="../js/content.min.js?v=1.0.0"></script>
    <script src="../js/jquery.form.js"></script>

    <script>
        $("#imgpath").change(function () {
            $("#P_Img").attr("src", URL.createObjectURL($(this)[0].files[0]));
        });
        $(function () {
            var options = {
                target: '#frm',
                success: suncess,
                url: "../Hanlder/GoodsHandler.ashx?Method=Edit",
                type: "post",

                dataType: "json",
                timeout: 3000
            }
            $("#frm").ajaxForm(options);
            function suncess(data) {
                var res = data;
                console.log(res);
                if (res.states == 1) {
                    parent.layer.msg(res.msg);
                }
                else {
                    parent.layer.msg('操作成功', function () {
                        parent.layer.closeAll();
                    });
                }
            }
        })
    </script>
</body>
</html>
